﻿@using FangDuShi_Admin.Common;
@using AspNet.Mvc.Grid;
@using Share.Bonnet.Pager;
@using System.Collections.Generic;
@model  AspNet.Mvc.Grid.Pagination.IPagination<FangDuShi_Admin.Model.HSVersionPC>

@{
    Layout = null;


    string pageout = ViewData["pageout"] == null ? "1" : ViewData["pageout"].ToString();
}

<!DOCTYPE html>

<html>

<head>
    <meta name="viewport" content="width=device-width" />
    <title>ip地址白名单管理</title>

    <link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css" />
    <!-- jQuery UI theme -->
    <link rel="stylesheet" href="/lib/jquery-ui/css/Aristo/Aristo.css" />
    <!-- tooltips-->
    <link rel="stylesheet" href="/lib/jBreadcrumbs/css/BreadCrumb.css" />
    <!-- tooltips-->
    <link rel="stylesheet" href="/lib/qtip2/jquery.qtip.min.css" />
    <!-- colorbox -->
    <link rel="stylesheet" href="/lib/colorbox/colorbox.css" />
    <!-- code prettify -->
    <link rel="stylesheet" href="/lib/google-code-prettify/prettify.css" />
    <!-- sticky notifications -->
    <link rel="stylesheet" href="/lib/sticky/sticky.css" />
    <!-- aditional icons -->
    <link rel="stylesheet" href="/img/splashy/splashy.css" />
    <!-- flags -->
    <link rel="stylesheet" href="/img/flags/flags.css" />
    <!-- datatables -->
    <link rel="stylesheet" href="/lib/datatables/extras/TableTools/media/css/TableTools.css">

    <!-- calendar -->
    <link rel="stylesheet" href="/lib/fullcalendar/fullcalendar_gebo.css" />

    <!-- main styles -->
    <link rel="stylesheet" href="/css/style.css" />
    <!-- theme color-->
    <link rel="stylesheet" href="/css/blue.css" id="link_theme" />

    <!--             <link href='http://fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css'> -->
    <!-- favicon -->
    <link rel="shortcut icon" href="favicon.ico" />

    <!--[if lte IE 8]>
        <link rel="stylesheet" href="css/ie.css" />
    <![endif]-->
    <!--[if lt IE 9]>
        <script src="js/ie/html5.js"></script>
        <script src="js/ie/respond.min.js"></script>
        <script src="/lib/flot/excanvas.min.js"></script>
    <![endif]-->

</head>

<body onload="iframeAutoFit()">

    <div id="jCrumbs" class="breadCrumb module">
        <ul>
            <li>
                <a href="#"><i class="glyphicon glyphicon-home"></i></a>
            </li>
            <li>
                <a href="#">首页</a>
            </li>
            <li>
                <a href="#">导航</a>
            </li>
            <li>
                <a href="#">栏目</a>
            </li>
            <li>
                <a href="#"> 信息</a>
            </li>
            <li>
                版本管理
            </li>
        </ul>
    </div>

    <div class="row ">

        <div class="col-sm-12 col-md-12">
            <div class=" panel panel-success">


                <div class=" panel-heading ">
                    <ul class="nav nav-pills">

                        <li role="presentation" class="active">
                            <a  onclick="veradd()">新增</a>
                        </li>
                        <li role="presentation">
                            <a href="javascript:delall()">批量删除</a>
                        </li>
                        
                    </ul>
                </div>
                <div class="panel-body tabbable tabbable-bordered">
                    <div class="row">


                   
                        <div class="col-sm-12 col-md-12">

                            @Html.Grid(Model).Columns(column =>
                       {
                           column.For(x => "<input type='checkbox' name='checkbox2' id='" + x.FID + "' />").Header(x => @"<input type='checkbox' name='checkbox' id='chkALL' />").Attributes(@style => "text-align:center;width:60px;").HeaderAttributes(@style => "text-align:center;width:60px;").Encode(false);
                           column.For(x => @"<a href='#'  onclick='VerEdit(" + x.FID + ")'><img src='/img/t02.png'></a><a href='#' onclick='delVer(" + x.FID + ")'><img src='/img/t03.png'></a>").Named("操作").Attributes(@style => "text-align:center;width:100px;").HeaderAttributes(@style => "text-align:center;width:100px;").Encode(false);

                           column.For(x => x.FVersionNo).Attributes(@style => "text-align:center;width:100px;").HeaderAttributes(@style => "text-align:center;width:100px;").Named("版本").Encode(false);
                           column.For(x => x.FPubDate.ToString("yyyy-MM-dd HH:mm")).HeaderAttributes(@style => "text-align:center;").Named("创建时间").Encode(false);
                           column.For(x => x.FIsMustUpdate == "Y" ? "<input type='checkbox' checked='checked'  disabled='disabled' />" : "<input type='checkbox' disabled='disabled' /").Attributes(@style => "text-align:center;width:100px;").HeaderAttributes(@style => "text-align:center;width:100px;").Named("需强制升级").Encode(false);
                           column.For(x => x.FContent).Named("备注").HeaderAttributes(@style => "text-align:center;").Encode(false);
                       }).Attributes(@class => "table table-striped table-bordered dTableR").Empty("无记录")
                            <div class="row">

                                <div class="col-sm-5">
                                    <div class="dataTables_info" id="dt_a_info">显示 @Model.FirstItem 项至 @Model.LastItem 项共 @Model.TotalItems 条数据</div>
                                </div>
                                <div class="col-sm-7">
                                    <div class="dataTables_paginate paging_bootstrap_alt">
                                        @Share.Bonnet.Pager.Pager.RenderPagination(this.Html, ViewData["Page"] as IPagerData, (page, text) => Html.ActionLink(new HtmlContainer(text), "Index", new { Page = page }))
                                    </div>
                                </div>
                            </div>


                        </div>


                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="/Scripts/jquery.min.js"></script>
    <script src="/Scripts/jquery-migrate.min.js"></script>
    <script src="/lib/jquery-ui/jquery-ui-1.10.0.custom.min.js"></script>
    <!-- touch events for jquery ui-->
    <script src="/Scripts/forms/jquery.ui.touch-punch.min.js"></script>
    <!-- easing plugin -->
    <script src="/Scripts/jquery.easing.1.3.min.js"></script>
    <!-- smart resize event -->
    <script src="/Scripts/jquery.debouncedresize.min.js"></script>
    <!-- js cookie plugin -->
    <script src="/Scripts/jquery_cookie_min.js"></script>
    <!-- main bootstrap js -->
    <script src="/bootstrap/js/bootstrap.min.js"></script>
    <!-- bootstrap plugins -->
    <script src="/Scripts/bootstrap.plugins.min.js"></script>
    <!-- typeahead -->
    <script src="/lib/typeahead/typeahead.min.js"></script>
    <!-- code prettifier -->
    <script src="/lib/google-code-prettify/prettify.min.js"></script>
    <!-- sticky messages -->
    <script src="/lib/sticky/sticky.min.js"></script>
    <!-- tooltips -->
    <script src="/lib/qtip2/jquery.qtip.min.js"></script>
    <!-- lightbox -->
    <script src="/lib/colorbox/jquery.colorbox.min.js"></script>
    <!-- jBreadcrumbs -->
    <script src="/lib/jBreadcrumbs/js/jquery.jBreadCrumb.1.1.min.js"></script>
    <!-- hidden elements width/height -->
    <script src="/Scripts/jquery.actual.min.js"></script>
    <!-- custom scrollbar -->
    <script src="/lib/slimScroll/jquery.slimscroll.js"></script>
    <!-- fix for ios orientation change -->
    <script src="/Scripts/ios-orientationchange-fix.js"></script>
    <!-- to top -->
    <script src="/lib/UItoTop/jquery.ui.totop.min.js"></script>
    <!-- mobile nav -->
    <script src="/Scripts/selectNav.js"></script>
    <!-- common functions -->
    <!--	<script src="js/gebo_common.js"></script>-->

    <script src="/lib/datatables/jquery.dataTables.min.js"></script>
    <script src="/lib/datatables/extras/Scroller/media/js/dataTables.scroller.min.js"></script>
    <!-- datatable table tools -->
    <script src="/lib/datatables/extras/TableTools/media/js/TableTools.min.js"></script>
    <script src="/lib/datatables/extras/TableTools/media/js/ZeroClipboard.js"></script>
    <!-- datatables bootstrap integration -->
    <script src="/lib/datatables/jquery.dataTables.bootstrap.min.js"></script>

    <!-- datatable functions -->
    <script src="/Scripts/gebo_datatables.js"></script>



    <script type="text/javascript">
       
        $(document).ready(function()
        {
            $("#myPopup").on('shown.bs.modal', function () {

                parent.$('html,body').animate({ scrollTop: '0px' }, 1500);
            });

            $('#chkALL').change(function () {
                if ($('#chkALL').is(':checked')) {
                    $(':checkbox[name=checkbox2]').each(function () {
                        $(this).attr('checked', true);
                    })
                }
                else {
                    $(':checkbox[name=checkbox2]').each(function () {
                        $(this).attr('checked', false);
                    })
                }
            });
        })

        function veradd() {

            parent.$("#popContent").attr("src", '@Url.Action("VerAdd", "HSVersionPC")');
            parent.$("#poptxt").text("新增版本");
            parent.$("#myPopup").modal('show');
          //  iframeAutoFit();
            
        }
        function delVer(strIds) {

            if (confirm("确定要删除吗")) {


                $.ajax({
                    type: 'POST',
                    url: '@Url.Action("DelList", "HSVersionPC")',
                    data: { ids: strIds },
                    success: function (result) {

                        if (result == "ok") {
                            alert("删除成功");
                            window.location.reload();
                        }
                        else {

                            alert(result);
                        }
                    }
                });

            }
        }
        function delall() {

            var idArray = new Array();
            $(':checkbox[name=checkbox2]:checked').each(function () {
                var strId = $(this).attr('id');

                idArray.push(strId);
            });
            if (idArray.length == 0) {
                alert('请选择需要删除的提醒项。');
            }
            else {
                if (confirm("确定要删除吗")) {
                    var strIds = idArray.join(",");

                    $.ajax({
                        type: 'POST',
                        url: '@Url.Action("DelList", "HSVersionPC")',
                        data: { ids: strIds },
                        success: function (result) {

                            if (result == "ok") {
                                alert("删除成功");
                                window.location.reload();
                            }
                            else {

                                alert(result);
                            }
                        }
                    });

                }
            }
        }
        function VerEdit(fid) {
            parent.$("#poptxt").text("编辑版本");
            parent.$("#popContent").attr("src", '@Url.Content("~/HSVersionPC/VerEdit?FID=")' + fid);
            parent.$("#myPopup").modal('show');
          //  iframeAutoFit();
            
        }
        function codeOK() {

            $("#myPopup").modal('hide');
            window.location.href = '@Url.Action("Index", "HSVersionPC", new { Page = pageout })'
        }
        function iframeAutoFit() {
            var ex;
            try {
                if (window != parent) {
                    var a = parent.document.getElementsByTagName("iframe");
                    for (var i = 0; i < a.length; i++) {
                        if (a[i].contentWindow == window) {
                            var h1 = 0,
                                h2 = 0;
                            if (document.documentElement && document.documentElement.scrollHeight) {
                                h1 = document.documentElement.scrollHeight;
                            }
                            if (document.body) h2 = document.body.scrollHeight;
                            var h = Math.max(h1, h2);
                            if (window.ActiveXObject) {
                                h += 4;
                            } else {
                                h += 4;
                            }
                            a[i].style.height = h + "px";
                            window.removeEventListener('resize', iframeAutoFit, false); //兼容谷歌浏览器时要去掉RISZE监听
                        }
                    }
                }
            } catch (ex) { }
        }
    </script>

</body>

</html>